* Schooled by Strikes? The Effects of Large-Scale Labor Unrest on Mass Attitudes Towards the Labor Movement
* Qualtrics survey analysis reported in the paper

* Set log

log using mainpaper, replace

* Load replication data for Qualtrics survey

use "qualtrics.dta", clear

* Who remembers walkouts? (page 14)

table stateabb [aw=weight], c(mean rememwalkouts_bin)

* Who reported walkouts/strikes in their local community schools? (page 15/Table 2)

table stateabb [aw=weight], c(mean walkoutcity_bin mean walkoutchildteach_bin)
sum walkoutcity_bin walkoutchildteach_bin [aw=weight]

* Overall support for walkouts (page 15/Table 3)

tab supportwalkouts stateabb [aw=weight], col

* Descriptive statistics for study outcomes (Table 4)

sum supportwalkouts_r walkoutparticipate_bin supportunionlawindex supportfuturestrikes donation_1 unioninf_r [aw=weight], sep(0)
sum unionvote_bin if emp==1 & unionmem_bin==0 [aw=weight],sep(0)
sum strikenextyr_r if emp==1 [aw=weight], sep(0)

* Correlation between main outcome variables (attitudes; reported in Appendix 4)

pwcorr stdsupportwalkouts_r stdwalkoutparticipate_bin stdsupportunionlawindex stdsupportfuturestrikesindex stdunioninf_r stddonation_1

* Cronbach's alpha for outcomes as reported on page 17

alpha stdsupportwalkouts_r stdwalkoutparticipate_bin stdsupportunionlawindex stdsupportfuturestrikesindex stdunioninf_r stddonation_1

* Correlational analysis of general strike experience and support for labor (Figure 2)

rename stdsupportfuturestrikesindex stdsupportfutstrikesindex

global demos i.party3 polideocons econliberal parent female age age_sq white hispanic logtotalfaminc i.educ unionmem_bin knntunionmem_bin religionattend_r i.state 

foreach outcome of varlist stdsupportwalkouts_r stdwalkoutparticipate_bin stdsupportunionlawindex stdsupportfutstrikesindex stdunioninf_r stddonation_1 stdattitudeindex{
	reg `outcome' anywalkoutexperience   i.state $demos [aweight=weight] ,robust
	estimates store cr`outcome'
}

reg stdunionvote_bin anywalkoutexperience i.state $demos [aweight=weight] if emp==1 & unionmem_bin==0, robust
estimates store crunionvote_bin

reg stdstrikenextyr_r anywalkoutexperience i.state $demos [aweight=weight] if emp==1, robust
estimates store crstrikenextyr_r

#delimit ;
coefplot
crstdsupportwalkouts_r
crstdwalkoutparticipate_bin
crstdsupportunionlawindex
crstdsupportfutstrikesindex
crstdunioninf_r
crstddonation_1
crstdattitudeindex
crstrikenextyr_r
crunionvote_bin
, keep(anywalkoutexperience) 
swap aseq nooff legend(off)
coeflabels(crstdsupportwalkouts_r="Support Walkouts (1-5)"
crstdwalkoutparticipate_bin="Participate in Walkouts (0/1)"
crstdsupportunionlawindex="Pro Teacher Union Rights (1-5)"
crstdsupportfutstrikesindex="Pro Future Teacher Strikes (1-5)"
crstdunioninf_r="Support Stronger Unions (1-5)"
crstddonation_1="Donate to LA Teacher Strike (0/1)"
crstdattitudeindex="Attitude Index"
crstrikenextyr_r="Go on Strike Next Year (1-5)"
crunionvote_bin="Pro Union Representation (0/1)")
xtitle("Coefficient on Any Walkout Experience (0/1)")
note("95% confidence intervals" "Survey weights applied" "Including demographic controls and state FE" "Robust Std. Errors applied")
;
#delimit cr
graph export "figure2.pdf", replace

* Parents with school-aged children more likely to report firsthand experience with strikes (page 21)

table childenroll_all, c(mean  anywalkoutexperience) 

reg anywalkoutexperience childenroll_all

* Parents with children in school different from other respondents (page 21)

bys childenroll_all: sum party3 polideocons econliberalism female age white hispanic logtotalfaminc educ unionmem_bin religionattend_r, sep(0)

* Set up for first stage/reduced form/IV regressions

set more off

replace strikenextyr_r = . if emp ==0

replace unionvote_bin = . if emp ==0 | unionmem_bin==1

label var child5up17down "School Eligible Age Child"

rename walkoutparticipate_bin walkoutpart_bin 
rename supportunionlawindex sunionlawindex
rename supportfuturestrikesindex sstrikesindex
rename walkoutchildteach_bin walkout_bin
rename anywalkoutexperience any_walkout

global predetermined age female white party3 econliberalism hispanic polideocons logtotalfaminc educ unionmem_bin knntunionmem_bin religionattend_r
global controls age age_sq female white i.party3 econliberalism hispanic polideocons logtotalfaminc i.educ unionmem_bin knntunionmem_bin religionattend_r
global firststagevars childenroll_all traditionalpublic walkout_bin any_walkout
global rfvars supportwalkouts_r   walkoutpart_bin sunionlawindex sstrikesindex unioninf_r donation_1 attitudeindex 
global rfvars_emp strikenextyr_r unionvote_bin
 
foreach var of varlist $predetermined $firststagevars $rfvars $rfvars_emp{
	egen s`var' = std(`var')
}

* Placebo check for balance on demographics between parents with and without just-school-aged children (Appendix 7)

foreach rw in "46_18" "28_20"{
	mat mat_`rw' = J(12,3,.)
	mat rownames mat_`rw' = "Age" "Female" "White" "Party ID (1-3)" "Economic Liberalism (1-5)" "Hispanic"  "Conservative (1-7)"  "Log Family Income" "Education (1-6)" "Union Member" "Know Union Member (0/1)" "Religious Attendance (0/1)"

	local row = 1 
	foreach outcome of varlist $predetermined {
		reg s`outcome'  child5up17down i.state if child_`rw'_window == 1, robust
		* point estimate
		mat mat_`rw'[`row',1] = _b[child5up17down]
		* lower CI
		mat mat_`rw'[`row',2] = _b[child5up17down] + invnorm(0.025)*_se[child5up17down] 
		* upper CI
		mat mat_`rw'[`row',3] = _b[child5up17down] + invnorm(0.975)*_se[child5up17down] 
		local ++row
	}
}

foreach rw in "46_18" "28_20"{
	local alab = cond("`rw'" == "46_18", "4 to 6 and 16 to 18", "2 to 8 and 14 to 20") 

	#delimit ;
		coefplot (matrix(mat_`rw'[,1]),  ci((mat_`rw'[,2] mat_`rw'[,3])) m(circle) mco(green) ciop(lc(green)) nomlabel) 
			, xline(0) tit("Placebo")
			xtitle("OLS Coefficient on School Eligible Child Indicator")
			note("95% Confidence Intervals" "Including state FE" "Robust Std. Errors" "`alab' Child Age Window")
			legend(lc(white) nobox) 
			;
		#delimit cr
		graph save "placebo_window`rw'.gph", replace
		graph export "placebo_window`rw'.pdf", replace
		graph export "placebo_window`rw'.png", replace
}
* together 
	#delimit ;
	coefplot (matrix(mat_46_18[,1]),  ci((mat_46_18[,2] mat_46_18[,3]))  m(circle) mco(green) ciop(lc(green)) label("4 to 6 and 16 to 18")) 
			(matrix(mat_28_20[,1]),  ci((mat_28_20[,2] mat_28_20[,3])) m(circle) mco(pink) ciop(lc(pink)) label("2 to 8 and 14 to 20")) 
		, xline(0) tit("Predetermined Outcomes")
			xtitle("OLS Coefficient on School Eligible Child Indicator")
			note("95% Confidence Intervals" "Including state FE" "Robust Std. Errors" )
		legend(lc(white) nobox)
		;

	#delimit cr
		graph save "placebo_window_combined.gph", replace
		graph export "placebo_window_combined.pdf", replace
		graph export "placebo_window_combined.png", replace
	
* First stage results of just-school-aged children (Appendix 8) 

foreach rw in "46_18" "28_20"{
	mat drop mat_`rw'
	mat mat_`rw' = J(4,6,.)
	mat rownames mat_`rw' = "Child In School" "Child in Public School" "Walkout in School" "Exposed to Walkout" 

	local row = 1 
	foreach outcome of varlist $firststagevars {
		reg s`outcome'  child5up17down i.state if child_`rw'_window == 1, robust
		* point estimate
		mat mat_`rw'[`row',1] = _b[child5up17down]
		* lower CI
		mat mat_`rw'[`row',2] = _b[child5up17down] + invnorm(0.025)*_se[child5up17down] 
		* upper CI
		mat mat_`rw'[`row',3] = _b[child5up17down] + invnorm(0.975)*_se[child5up17down] 

		reg s`outcome'  child5up17down i.state $controls if child_`rw'_window == 1, robust
		* point estimate
		mat mat_`rw'[`row',4] = _b[child5up17down]
		* lower CI
		mat mat_`rw'[`row',5] = _b[child5up17down] + invnorm(0.025)*_se[child5up17down] 
		* upper CI
		mat mat_`rw'[`row',6] = _b[child5up17down] + invnorm(0.975)*_se[child5up17down]


		local ++row

		
	}
}

foreach rw in "46_18" "28_20"{
	local alab = cond("`rw'" == "46_18", "4 to 6 and 16 to 18", "2 to 8 and 14 to 20") 

	* with controls 
	#delimit ;
	coefplot (matrix(mat_`rw'[,1]),  ci((mat_`rw'[,2] mat_`rw'[,3])) m(circle) mco(green) ciop(lc(green)) label("Without Controls")) 
		, xline(0) tit("First Stage")
		xtitle("OLS Coefficient on School Eligible Child Indicator")
		note("95% confidence intervals" "Including state FE" "Robust SEs" "`alab' Child Age Window")
		legend(lc(white) nobox)
		;

	#delimit cr
	graph export "fs_window`rw'_y.pdf", replace
	graph export "fs_window`rw'_y.png", replace

	* without controls
	#delimit ;
	coefplot (matrix(mat_`rw'[,4]),  ci((mat_`rw'[,5] mat_`rw'[,6])) m(circle) mco(pink) ciop(lc(pink)) label("With Controls")) 
		, xline(0) tit("First Stage")
		xtitle("OLS Coefficient on School Eligible Child Indicator")
		note("95% confidence intervals" "Including state FE" "Robust SEs" "`alab' Child Age Window")
		legend(lc(white) nobox) 
		;

	#delimit cr
	graph export "fs_window`rw'_n.pdf", replace
	graph export "fs_window`rw'_n.png", replace

	* together 
	#delimit ;
	coefplot (matrix(mat_`rw'[,1]),  ci((mat_`rw'[,2] mat_`rw'[,3]))  m(circle) mco(green) ciop(lc(green)) label("Without Controls")) 
			(matrix(mat_`rw'[,4]),  ci((mat_`rw'[,5] mat_`rw'[,6])) m(circle) mco(pink) ciop(lc(pink)) label("With Controls")) 
		, xline(0) tit("First Stage")
		xtitle("OLS Coefficient on School Eligible Child Indicator")
		note("95% confidence intervals" "Including state FE" "Robust SEs" "`alab' Child Age Window")
		legend(lc(white) nobox)
		;

	#delimit cr
	graph save "fs_window`rw'.gph", replace
	graph export "fs_window`rw'.pdf", replace
	graph export "fs_window`rw'.png", replace
	
}


	* together
	#delimit ;
	coefplot (matrix(mat_46_18[,1]),  ci((mat_46_18[,2] mat_46_18[,3]))  m(circle) mco(green) ciop(lc(green)) label("4/6-16/18 Window")) 
			(matrix(mat_46_18[,4]),  ci((mat_46_18[,5] mat_46_18[,6])) m(circle) mco(pink) ciop(lc(pink)) label("4/6-16/18 With Controls")) 
			(matrix(mat_28_20[,1]),  ci((mat_28_20[,2] mat_28_20[,3]))  m(diamond) mco(green) ciop(lc(green)) label("2/8-14/20 Window")) 
			(matrix(mat_28_20[,4]),  ci((mat_28_20[,5] mat_28_20[,6])) m(diamond) mco(pink) ciop(lc(pink)) label("2/8-14/20 With Controls")) 
		, xline(0) tit("First Stage")
		xtitle("OLS Coefficient on School Eligible Child Indicator")
		note("95% confidence intervals" "Including state FE" "Robust SEs" )
		legend(lc(white) nobox)
		;

	#delimit cr
	graph export "fs_window_pooled.png", replace

* Reduced form analysis (Figure 3/Appendix 9)

foreach rw in "46_18" "28_20"{
	mat drop mat_`rw'
	mat mat_`rw' = J(9,6,.)
	mat rownames mat_`rw' = "Support Walkouts (1-5)" "Participate in Walkouts (0/1)" "Pro Teacher Union Rights (1-5)" "Pro Future Teacher Strikes (1-5)" "Support Stronger Unions (1-5)" "Donate to LA Teacher Strike" "Attitude Index" "Go on Strike Next Year (1-5)" "Pro Union Representation (0/1)"	
	
	local row = 1 
	foreach outcome of varlist $rfvars{
		* without controls
		reg  s`outcome'  child5up17down i.state if child_`rw'_window == 1, robust
		* point estimate
		mat mat_`rw'[`row',1] = _b[child5up17down]
		* lower CI
		mat mat_`rw'[`row',2] = _b[child5up17down] + invnorm(0.025)*_se[child5up17down] 
		* upper CI
		mat mat_`rw'[`row',3] = _b[child5up17down] + invnorm(0.975)*_se[child5up17down] 

		* with controls
		reg s`outcome' child5up17down i.state $controls if child_`rw'_window == 1, robust
		* point estimate
		mat mat_`rw'[`row',4] = _b[child5up17down]
		* lower CI
		mat mat_`rw'[`row',5] = _b[child5up17down] + invnorm(0.025)*_se[child5up17down] 
		* upper CI
		mat mat_`rw'[`row',6] = _b[child5up17down] + invnorm(0.975)*_se[child5up17down]


		local ++row
		
	}


	local row = 8
	foreach outcome of varlist $rfvars_emp{
	* without controls
		reg  s`outcome'  child5up17down i.state if child_`rw'_window == 1 & emp==1, robust
		* point estimate
		mat mat_`rw'[`row',1] = _b[child5up17down]
		* lower CI
		mat mat_`rw'[`row',2] = _b[child5up17down] + invnorm(0.025)*_se[child5up17down] 
		* upper CI
		mat mat_`rw'[`row',3] = _b[child5up17down] + invnorm(0.975)*_se[child5up17down] 

		* with controls
		reg s`outcome' child5up17down i.state $controls if child_`rw'_window == 1 & emp==1, robust
		* point estimate
		mat mat_`rw'[`row',4] = _b[child5up17down]
		* lower CI
		mat mat_`rw'[`row',5] = _b[child5up17down] + invnorm(0.025)*_se[child5up17down] 
		* upper CI
		mat mat_`rw'[`row',6] = _b[child5up17down] + invnorm(0.975)*_se[child5up17down]


		local ++row

	}
	
}

foreach rw in "46_18" "28_20"{
	local alab = cond("`rw'" == "46_18", "4 to 6 and 16 to 18", "2 to 8 and 14 to 20") 

	* with controls 
	#delimit ;
	coefplot (matrix(mat_`rw'[,1]),  ci((mat_`rw'[,2] mat_`rw'[,3])) m(circle) mco(green) ciop(lc(green)) label("Without Controls")) 
		, xline(0) tit("Reduced Form")
		xtitle("OLS Coefficient on School Eligible Child Indicator")
		note("95% confidence intervals" "Including state FE" "Robust SEs" "`alab' Child Age Window")
		legend(lc(white) nobox)
		;

	#delimit cr
	graph export "RF_window`rw'_y.pdf", replace
	graph export "RF_window`rw'_y.png", replace

	* without controls
	#delimit ;
	coefplot (matrix(mat_`rw'[,4]),  ci((mat_`rw'[,5] mat_`rw'[,6])) m(circle) mco(pink) ciop(lc(pink)) label("With Controls")) 
		, xline(0) tit("Reduced Form")
		xtitle("OLS Coefficient on School Eligible Child Indicator")
		note("95% confidence intervals" "Including state FE" "Robust SEs" "`alab' Child Age Window")
		legend(lc(white) nobox)
		;

	#delimit cr
	graph export "RF_window`rw'_n.pdf", replace
	graph export "RF_window`rw'_n.png", replace

	* together 
	#delimit ;
	coefplot (matrix(mat_`rw'[,1]),  ci((mat_`rw'[,2] mat_`rw'[,3]))  m(circle) mco(green) ciop(lc(green)) label("Without Controls")) 
			(matrix(mat_`rw'[,4]),  ci((mat_`rw'[,5] mat_`rw'[,6])) m(circle) mco(pink) ciop(lc(pink)) label("With Controls")) 
		, xline(0) tit("Reduced Form")
		xtitle("OLS Coefficient on School Eligible Child Indicator")
		note("95% confidence intervals" "Including state FE" "Robust SEs" "`alab' Child Age Window")
		legend(lc(white) nobox)
		;

	#delimit cr
	graph save "RF_window`rw'.gph", replace
	graph export "RF_window`rw'.pdf", replace
	graph export "RF_window`rw'.png", replace
	
}
graph combine "RF_window46_18.gph" "RF_window28_20.gph"
graph export "RF_window_combined.pdf", replace



	#delimit ;
	coefplot (matrix(mat_46_18[,1]),  ci((mat_46_18[,2] mat_46_18[,3]))  m(circle) mco(green) ciop(lc(green)) label("4/6-16/18 Window")) 
			(matrix(mat_46_18[,4]),  ci((mat_46_18[,5] mat_46_18[,6])) m(circle) mco(pink) ciop(lc(pink)) label("4/6-16/18 With Controls")) 
			(matrix(mat_28_20[,1]),  ci((mat_28_20[,2] mat_28_20[,3]))  m(diamond) mco(green) ciop(lc(green)) label("2/8-14/20 Window")) 
			(matrix(mat_28_20[,4]),  ci((mat_28_20[,5] mat_28_20[,6])) m(diamond) mco(pink) ciop(lc(pink)) label("2/8-14/20 With Controls")) 
		, xline(0) xtitle("OLS Coefficient on School Eligible Child Indicator")
		note("95% confidence intervals" "Including state FE" "Robust SEs" )
		legend(lc(white) nobox)
		;

	#delimit cr
	graph export "RF_window_pooled.png", replace
	
* Instrumental variables analysis (Figure 4/Appendix 10)

foreach rw in "46_18" "28_20"{
	mat drop mat_`rw'
	mat mat_`rw' = J(9,6,.)
	mat rownames mat_`rw' = "Support Walkouts (1-5)" "Participate in Walkouts (0/1)" "Pro Teacher Union Rights (1-5)" "Pro Future Teacher Strikes (1-5)" "Support Stronger Unions (1-5)" "Donate to LA Teacher Strike" "Attitude Index" "Go on Strike Next Year (1-5)" "Pro Union Representation (0/1)"	
	
	local row = 1 
	foreach outcome of varlist $rfvars{
	
		* without controls
		qui ivregress 2sls s`outcome' (walkout_bin = child5up17down) i.state if child_`rw'_window == 1, robust
		* point estimate
		mat mat_`rw'[`row',1] = _b[walkout_bin]
		* lower CI
		mat mat_`rw'[`row',2] = _b[walkout_bin] + invnorm(0.025)*_se[walkout_bin] 
		* upper CI
		mat mat_`rw'[`row',3] = _b[walkout_bin] + invnorm(0.975)*_se[walkout_bin] 

		* with controls
		qui ivregress 2sls s`outcome' (walkout_bin = child5up17down) i.state $controls if child_`rw'_window == 1, robust
		* point estimate
		mat mat_`rw'[`row',4] = _b[walkout_bin]
		* lower CI
		mat mat_`rw'[`row',5] = _b[walkout_bin] + invnorm(0.025)*_se[walkout_bin] 
		* upper CI
		mat mat_`rw'[`row',6] = _b[walkout_bin] + invnorm(0.975)*_se[walkout_bin] 


		local ++row
		
	}
	
	local row = 8 
	foreach outcome of varlist $rfvars_emp{
	
		* without controls
		qui ivregress 2sls s`outcome' (walkout_bin = child5up17down) i.state if child_`rw'_window == 1  & emp==1, robust
		* point estimate
		mat mat_`rw'[`row',1] = _b[walkout_bin]
		* lower CI
		mat mat_`rw'[`row',2] = _b[walkout_bin] + invnorm(0.025)*_se[walkout_bin] 
		* upper CI
		mat mat_`rw'[`row',3] = _b[walkout_bin] + invnorm(0.975)*_se[walkout_bin] 

		* with controls
		qui ivregress 2sls s`outcome' (walkout_bin = child5up17down) i.state $controls if child_`rw'_window == 1 & emp==1, robust
		* point estimate
		mat mat_`rw'[`row',4] = _b[walkout_bin]
		* lower CI
		mat mat_`rw'[`row',5] = _b[walkout_bin] + invnorm(0.025)*_se[walkout_bin] 
		* upper CI
		mat mat_`rw'[`row',6] = _b[walkout_bin] + invnorm(0.975)*_se[walkout_bin] 


		local ++row
		
	}
}


foreach rw in "46_18" "28_20"{
	local alab = cond("`rw'" == "46_18", "4 to 6 and 16 to 18", "2 to 8 and 14 to 20") 

	* with controls 
	#delimit ;
	coefplot (matrix(mat_`rw'[,1]),  ci((mat_`rw'[,2] mat_`rw'[,3])) m(circle) mco(green) ciop(lc(green)) label("Without Controls")) 
		, xline(0) tit("IV")
		xtitle("2SLS Coefficient on Walkouts in Child's School")
		note("95% Confidence Intervals" "Including state FE" "Robust Std. Errors" "`alab' Child Age Window")
		legend(lc(white) nobox)
		;

	#delimit cr
	graph export "2sls_window`rw'_y.pdf", replace
	graph export "2sls_window`rw'_y.png", replace

	* without controls
	#delimit ;
	coefplot (matrix(mat_`rw'[,4]),  ci((mat_`rw'[,5] mat_`rw'[,6])) m(circle) mco(pink) ciop(lc(pink)) label("With Controls")) 
		, xline(0) tit("IV")
		xtitle("2SLS Coefficient on Walkouts in Child's School")
		note("95% Confidence Intervals" "Including state FE" "Robust Std. Errors" "`alab' Child Age Window")
		legend(lc(white) nobox)
		;

	#delimit cr
	graph export "2sls_window`rw'_n.pdf", replace
	graph export "2sls_window`rw'_n.png", replace

	* together 
	#delimit ;
	coefplot (matrix(mat_`rw'[,1]),  ci((mat_`rw'[,2] mat_`rw'[,3]))  m(circle) mco(green) ciop(lc(green)) label("Without Controls")) 
			(matrix(mat_`rw'[,4]),  ci((mat_`rw'[,5] mat_`rw'[,6])) m(circle) mco(pink) ciop(lc(pink)) label("With Controls")) 
		, xline(0) tit("IV")
		xtitle("2SLS Coefficient on Walkouts in Child's School")
		note("95% Confidence Intervals" "Including state FE" "Robust Std. Errors" "`alab' Child Age Window")
		legend(lc(white) nobox) 
		;

	#delimit cr
	graph save "2sls_window`rw'.gph", replace
	graph export "2sls_window`rw'.pdf", replace
	graph export "2sls_window`rw'.png", replace
	
}
graph combine "2sls_window46_18.gph" "2sls_window28_20.gph"
graph export "2sls_window_combined.pdf", replace


	#delimit ;
	coefplot (matrix(mat_46_18[,1]),  ci((mat_46_18[,2] mat_46_18[,3]))  m(circle) mco(green) ciop(lc(green)) label("4/6-16/18 Window")) 
			(matrix(mat_46_18[,4]),  ci((mat_46_18[,5] mat_46_18[,6])) m(circle) mco(pink) ciop(lc(pink)) label("4/6-16/18 With Controls")) 
			(matrix(mat_28_20[,1]),  ci((mat_28_20[,2] mat_28_20[,3]))  m(diamond) mco(green) ciop(lc(green)) label("2/8-14/20 Window")) 
			(matrix(mat_28_20[,4]),  ci((mat_28_20[,5] mat_28_20[,6])) m(diamond) mco(pink) ciop(lc(pink)) label("2/8-14/20 With Controls")) 
		, xline(0) xtitle("2SLS Coefficient on Walkouts in Child's School")
		note("95% Confidence Intervals" "Including state FE" "Robust Std. Errors" )
		legend(lc(white) nobox) 
		;

	#delimit cr
	graph export "2sls_window_pooled.png", replace

* Subset analysis to the two different child age windows (page 25)

* Limit to 16-18 window

eststo clear

reg stdattitudeindex child5up17down i.state if child_16_18 == 1, rob
eststo 

reg strikenextyr_r child5up17down i.state if child_16_18 == 1 & emp==1, rob
eststo

reg stdattitudeindex child5up17down $controls i.state if child_16_18 == 1, rob
eststo 

reg strikenextyr_r child5up17down $controls  i.state if child_16_18 == 1 & emp==1, rob
eststo

esttab using "childwindow1618.csv", keep(child5up17down) replace  b(a3)

* Limit to 4-6 window

eststo clear

reg stdattitudeindex child5up17down i.state if child_4_6 == 1, rob
eststo 

reg strikenextyr_r child5up17down i.state if child_4_6 == 1 & emp==1, rob
eststo

reg stdattitudeindex child5up17down $controls i.state if child_4_6 == 1, rob
eststo 

reg strikenextyr_r child5up17down $controls i.state if child_4_6 == 1 & emp==1, rob
eststo

esttab using "childwindow46.csv", keep(child5up17down) replace  b(a3)
 
* Subgroup analysis by political views, union ties, and personal costs of the strikes (Table 5/pages 26-27)

eststo clear

local subdemos_party polideocons econliberal parent female age age_sq white hispanic logtotalfaminc i.educ knntunionmem_bin unionmem_bin knntunionmem_bin religionattend_r i.state
local subdemos_ideo i.party3 econliberal parent female age age_sq white hispanic logtotalfaminc i.educ knntunionmem_bin unionmem_bin  knntunionmem_bin religionattend_r i.state
local subdemos_knowunion i.party3 econliberal parent female age age_sq white hispanic logtotalfaminc i.educ unionmem_bin knntunionmem_bin religionattend_r i.state

reg strikenextyr_r child5up17down `subdemos_party' i.state if child_46_18_window == 1 & party3==1 & emp==1, rob 
eststo
reg strikenextyr_r child5up17down `subdemos_party' i.state if child_46_18_window == 1 & party3==2 & emp==1, rob 
eststo
reg strikenextyr_r child5up17down `subdemos_party' i.state if child_46_18_window == 1 & party3==3 & emp==1, rob 
eststo

reg strikenextyr_r child5up17down `subdemos_ideo' i.state if child_46_18_window == 1 & polideo3==1 & emp==1, rob 
eststo
reg strikenextyr_r child5up17down `subdemos_ideo' i.state if child_46_18_window == 1 & polideo3==2 & emp==1, rob 
eststo
reg strikenextyr_r child5up17down `subdemos_ideo' i.state if child_46_18_window == 1 & polideo3==3 & emp==1, rob 
eststo

reg strikenextyr_r child5up17down `subdemos_knowunion' i.state if child_46_18_window == 1 & knowunionmem_bin==0 & emp==1, rob 
eststo
reg strikenextyr_r child5up17down `subdemos_knowunion' i.state if child_46_18_window == 1 & knowunionmem_bin==1 & emp==1, rob 
eststo

esttab using "Table5.csv", keep(child5up17down) replace b(a3) mtitle("Rep." "Ind." "Dem." "Lib." "Mod." "Cons." "No Union Tie" "Union Tie")

eststo clear

local subdemos_childcare i.party3 polideocons econliberal parent female age age_sq white hispanic logtotalfaminc i.educ knntunionmem_bin unionmem_bin religionattend_r i.state
 
reg strikenextyr_r child5up17down `subdemos_childcare' i.state if child_46_18_window == 1 & marriedpartner==0 & emp==1, rob 
eststo
reg strikenextyr_r child5up17down `subdemos_childcare' i.state if child_46_18_window == 1 & marriedpartner==1 & emp==1, rob 
eststo

esttab using "subgroup_childcare.csv", keep(child5up17down) replace b(a3) mtitle("Single Parent" "Married/Partner")

* Mechanisms analysis (Appendices 11-13)

* Text analysis - what do you remember a union doing recently? (Appendix 11)

eststo clear
foreach outcome of varlist txt_dk txt_strike txt_teachedschool txt_union txt_publicgood{
	reg `outcome' child5up17down  i.state    if child_46_18_window == 1 ,robust
	eststo
	reg `outcome' child5up17down $controls i.state if child_46_18_window == 1 ,robust
	eststo
}
esttab using "Appendix11.csv", replace keep(child5up17down)

* Perceptions of school quality (Appendix 12)

eststo clear
foreach outcome of varlist schoolgrade_r schoolgrade_hasopinion{
	reg `outcome' child5up17down  i.state    if child_46_18_window == 1 ,robust
	eststo
	reg `outcome' child5up17down $controls  if child_46_18_window == 1 ,robust
	eststo
}
esttab using "Appendix12.csv", replace keep(child5up17down)

* Heard from teacher/union about the strikes (Appendix 13)

eststo clear
foreach outcome of varlist howhear_6_r{
	reg `outcome' child5up17down  i.state if child_46_18_window == 1 ,robust
	eststo
	reg `outcome' child5up17down $controls if child_46_18_window == 1 ,robust
	eststo
}
esttab using "Appendix13.csv", replace keep(child5up17down)

* End log and export

log close
